package com.kitty.record.kittyjava.javaexception;

import com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl;

/**
 * @Description
 * @Author SHEN
 * @Date 2021/1/3
 */
public class ExceptionMain {

    public static void main(String[] args) {
        /*try {
            System.out.println("divForException(3,5) = " + divForException(3, 5));
        } catch (MyException e) {
            e.printStackTrace();
        }*/

        /*System.out.println("divForRunTimeException(3,5) = " + divForRunTimeException(3, 5));*/
    }


    public static int divForRunTimeException(int a,int b){
        if(a < b){
            throw new MyRunTimeException("a不能小于b！！");
        }
        return a/b;
    }

    public static int divForException(int a,int b) throws MyException {
        if(a < b){
            throw new MyException("a不能小于b！！");
        }
        return a/b;
    }
}
